﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace SageKing.Blazor.OpenIdService.Migrations.Template
{
    /// <inheritdoc />
    public partial class add_SourceName_Template : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropIndex(
                name: "IX_TemplateConfig_TemplateId_KKey",
                table: "TemplateConfig");

            migrationBuilder.AddColumn<string>(
                name: "SourceName",
                table: "TemplateConfig",
                type: "nvarchar(450)",
                nullable: false,
                defaultValue: "");

            migrationBuilder.CreateIndex(
                name: "IX_TemplateConfig_TemplateId_SourceName_KKey",
                table: "TemplateConfig",
                columns: new[] { "TemplateId", "SourceName", "KKey" },
                unique: true);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropIndex(
                name: "IX_TemplateConfig_TemplateId_SourceName_KKey",
                table: "TemplateConfig");

            migrationBuilder.DropColumn(
                name: "SourceName",
                table: "TemplateConfig");

            migrationBuilder.CreateIndex(
                name: "IX_TemplateConfig_TemplateId_KKey",
                table: "TemplateConfig",
                columns: new[] { "TemplateId", "KKey" },
                unique: true);
        }
    }
}
